package com.ostrich.cloud.ostrichUserService.client;

import com.ostrich.cloud.common.result.Result;

import com.ostrich.ostrichUserService.param.CusPasswordParam;
import com.ostrich.ostrichUserService.param.LoginCusParam;
import com.ostrich.ostrichUserService.param.RegCustomerParam;
import com.ostrich.ostrichUserService.param.UpdateCusParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;

/**
* name是项目名，contextId是client的名字
*/
@FeignClient(contextId = "customerMangerClient",name="ostrichUserService")
@Api("用户相关接口")
public interface CustomerMangerClient {

    @PostMapping("customerRegister")
    public Result customerRegister(@RequestBody @Valid RegCustomerParam regCustomerParam);

    @PostMapping("uploadCusImg")
    @ApiOperation("上传图片")
    public Result uploadCusImg(@RequestBody MultipartFile file) throws IOException;

    @ApiOperation("修改用户个人信息")
    @PostMapping("updateCusMessage")
    public Result updateCusMessage(@RequestBody UpdateCusParam updateCusParam);

    @GetMapping("getCusMessage")
    @ApiOperation("获取用户个人信息")
    public Result getCusMessage();

    @GetMapping("getAllCusMessage")
    @ApiOperation("获取所有的用户信息")
    public Result getAllCusMessage(@RequestParam("current") Integer current
    ,@RequestParam("size") Integer size,@RequestParam("status") String status);

    @PostMapping("customerLogin")
    @ApiOperation("顾客登录的接口")
    public Result customerLogin(@RequestBody LoginCusParam loginCusParam);

    @PutMapping("cusPasswordUp")
    @ApiOperation("修改用户密码")
    public Result cusPasswordUp(@RequestBody CusPasswordParam cusPasswordParam);

    @GetMapping("upCusStatus")
    @ApiOperation("修改用户状态")
    public Result upCusStatus(@RequestParam("parentId") Integer parentId
    ,@RequestParam("status") String status);

    /*
      支付宝充值
     */
    @GetMapping("/alipay/pay") // &subject=xxx&traceNo=xxx&totalAmount=xxx
    @ApiOperation("支付功能")
    public Result pay(@RequestParam("price") Double price);

    @PutMapping("updateMoney")
    @ApiOperation("修改用户余额")
    public Result updateMoney(@RequestParam("price") BigDecimal price);


    @GetMapping("getCustomerById")
    @ApiOperation("根据用户id查询用户信息")
    public Result getCustomerById(@RequestParam("customerId")Integer customerId);
}
